<%-- 
    Document   : insert_updatePro
    Created on : Sep 30, 2013, 1:33:29 PM
    Author     : NTB
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<jsp:include page="header.jsp"/>
<div id="wrapper-page">
  <div class="function-wrap">
    <c:set var="dt" value="${requestScope.DETAILS}"/>
    <c:if test="${not empty dt}">  
      <h2>Cập nhật sản phẩm</h2>
      <a href="C_Product?btAction=Pro_Search&txtSearch=" style="display:block;" ><div class="btnbackMenu"></div></a>
      <div class="listProduct">
        <h3>Thông tin chi tiết</h3>
        <div style="margin: 0 auto;margin-bottom: 20px;">
            <form action="C_Product" method="POST" enctype="multipart/form-data">                
            <input type="hidden" class="inputLog" name="masp" value="${dt.masp}"/>
            <table style="width: 950px; border: 1px solid #dedede; margin: 0 auto;" class="tables">
              <tbody>                  
                <tr>
                  <td>Tên sản phẩm:</td>
                  <td>
                    <div class="input-control text">
                      <input class="inputLog" name="txtsp" type="text" value="${dt.tensp}"/>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Đơn giá:</td>
                  <td>
                    <div class="input-control text">
                      <input class="inputLog" name="txtdongia" type="text" value="${dt.dongia}"/>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Số lượng:</td>
                  <td>
                    <div class="input-control text">
                      <input class="inputLog" name="txtsoluong" type="text" value="${dt.soluong}"/>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Loại sản phẩm:</td>
                  <td>
                    <div class="input-control select">
                      <c:set var="lProCate" value="${requestScope.lProCate}"/>
                      <c:if test="${not empty lProCate}">
                        <select name="maloaisp">
                          <c:forEach var="row" items="${lProCate}">
                            <c:if test="${dt.loaiSanPham.maloaisp==row.maloaisp}">
                              <option selected="selected" value="${row.maloaisp}">${row.tenloaisp}</option>
                            </c:if>
                            <c:if test="${dt.loaiSanPham.maloaisp!=row.maloaisp}">
                              <option value="${row.maloaisp}">${row.tenloaisp}</option>
                            </c:if>
                          </c:forEach>
                        </select>
                      </c:if>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Nhà cung cấp:</td>
                  <td>
                    <div class="input-control select">
                      <c:set var="lSup" value="${requestScope.lSup}"/>
                      <c:if test="${not empty lSup}">
                        <select name="mancc">
                          <c:forEach var="row" items="${lSup}">
                            <c:if test="${dt.nhaCungCap.mancc==row.mancc}">
                              <option selected="selected" value="${row.mancc}">${row.tenncc}</option>
                            </c:if>
                            <c:if test="${dt.nhaCungCap.mancc!=row.mancc}">
                              <option value="${row.mancc}">${row.tenncc}</option>
                            </c:if>
                          </c:forEach>
                        </select>
                      </c:if>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Hình ảnh</td>
                  <td>                      
                    <div class="input-control file">
                        <input type="file" name="hinhanh" class="inputLog"/>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>
                  </td>
                  <td>
                    <input type="hidden" name="btAction" value="Pro_Update"/> 
                    <input type="submit" name="submit" value="Sửa"/> 
                  </td>
                </tr>
              </tbody>
            </table>
          </form> 
        </div>
      </div>  
    </c:if>
    <c:set var="dt" value="${requestScope.INSERT}"/>
    <c:if test="${not empty dt}">  
      <h2>Thêm sản phẩm</h2>
      <a href="C_Product?btAction=Pro_Search&txtSearch=" style="display:block;" ><div class="btnbackMenu"></div></a>

      <div class="listProduct">
        <h3>Điền thông tin sản phẩm</h3>
        <div style="margin: 0 auto;margin-bottom: 20px;">
          <form action="C_Product" method="POST" enctype="multipart/form-data">
            <table style="width: 950px; border: 1px solid #dedede; margin: 0 auto;" class="tables">
              <tbody>                  
                <tr>
                  <td>Tên sản phẩm:</td>
                  <td>
                    <div class="input-control text">
                      <input class="inputLog" name="txtsp" type="text" value=""/>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Đơn giá:</td>
                  <td>
                    <div class="input-control text">
                      <input class="inputLog" name="txtdongia" type="text" value=""/>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Số lượng:</td>
                  <td>
                    <div class="input-control text">
                      <input class="inputLog" name="txtsoluong" type="text" value=""/>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Loại sản phẩm:</td>
                  <td>
                    <div class="input-control select">
                      <c:set var="lProCate" value="${requestScope.lProCate}"/>
                      <c:if test="${not empty lProCate}">
                        <select name="maloaisp">
                          <c:forEach var="row" items="${lProCate}">                            
                            <option value="${row.maloaisp}">${row.tenloaisp}</option>
                          </c:forEach>
                        </select>
                      </c:if>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Nhà cung cấp:</td>
                  <td>
                    <div class="input-control select">
                      <c:set var="lSup" value="${requestScope.lSup}"/>
                      <c:if test="${not empty lSup}">
                        <select name="mancc">
                          <c:forEach var="row" items="${lSup}">                            
                            <option value="${row.mancc}">${row.tenncc}</option>
                          </c:forEach>
                        </select>
                      </c:if>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>Hình ảnh</td>
                  <td>
                    <div class="input-control file">
                        <input type="file" name="hinhanh" class="inputLog"/>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>
                  </td>
                  <td>
                    <input type="hidden" name="btAction" value="Pro_Insert"/> 
                    <input type="submit" name="submit" value="Thêm"/> 
                  </td>
                </tr>
              </tbody>
            </table>
          </form> 
        </div>
      </div>  
    </c:if>
  </div>      
</div>              
</body>
</html>
